package com.peakmain.wanandroid.mymodule.animation;

import android.support.annotation.NonNull;
import android.support.v4.view.ViewPager;
import android.view.View;

/**
 * @author ：Peakmain
 * version ：1.0
 * createTime ：2018/10/12 0012 下午 3:19
 * mail : 2726449200@qq.com
 * describe ：
 */
public abstract class BasePageTransformer implements ViewPager.PageTransformer {
    @Override
    public void transformPage(@NonNull View view, float position) {
        //page当前的view
        //position = 0 当前页，完全可见
        //position = -1左边页，完全不可见
        //position=1 右边页，完全不可见
        if (position < -1 || position >=1) {
            other(view, position);
        } else if (position < 1) {
            if (position > -1 && position <=0.0f) {
                // [-1,0]
                touch2Left(view, position);
            } else if (position >0.0f && position <=1.0f) {
                // (0,1]
                touch2Right(view, position);
            }
        }
    }
    public abstract void touch2Left(View view, float position);
    public abstract void touch2Right(View view, float position);
    public abstract void other(View view, float position);
}
